home *** CD-ROM | disk | FTP | other *** search
- head 1.4;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.4
- date 92.01.10.15.44.17; author mottsmth; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.07.28.17.29.46; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.07.25.10.40.34; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.06.26.15.45.58; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.4
- log
- @Make sure it's a directory before we open it.
- @
- text
- @/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- */
-
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@@(#)opendir.c 5.2 (Berkeley) 3/9/86";
- #endif LIBC_SCCS and not lint
-
- #include <stdlib.h>
- #include <sys/param.h>
- #include <sys/dir.h>
- #include <sys/file.h>
- #include <sys/stat.h>
- #include <errno.h>
-
- /*
- * open a directory.
- */
- DIR *
- opendir(name)
- char *name;
- {
- register DIR *dirp;
- register int fd;
- struct stat statBuf;
-
- if (stat(name, &statBuf) == -1) {
- return NULL;
- }
- if (!S_ISDIR(statBuf.st_mode)) {
- errno = ENOTDIR;
- return NULL;
- }
- if ((fd = open(name, O_RDONLY, 0)) == -1) {
- return NULL;
- }
- if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
- close (fd);
- return NULL;
- }
- dirp->dd_fd = fd;
- dirp->dd_loc = 0;
- return dirp;
- }
- @
-
-
- 1.3
- log
- @Lint.
- @
- text
- @d15 2
- d22 1
- a22 1
- opendir(name)
- d27 1
- d29 1
- a29 1
- if ((fd = open(name, O_RDONLY, 0)) == -1)
- d31 8
- @
-
-
- 1.2
- log
- @Lint cleanup.
- @
- text
- @d14 1
- d26 1
- a26 1
- if ((fd = open(name, 0)) == -1)
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d11 1
- @
-